Skip to content

Comments

Fix DS MCMS contracts loading issue for legacy contracts#21291

Open
simsonraj wants to merge 3 commits intodevelopfrom
fix-ds-mcms-loading
Open

Fix DS MCMS contracts loading issue for legacy contracts#21291
simsonraj wants to merge 3 commits intodevelopfrom
fix-ds-mcms-loading

Conversation

@simsonraj
Copy link
Contributor

@simsonraj simsonraj commented Feb 24, 2026

This fixes a critical bug where the MCMS contract loading will panic for any network where Bypasser & cancellers role belong to same address. ( BSC-testnet for example)

Copilot AI review requested due to automatic review settings February 24, 2026 17:50
@simsonraj simsonraj requested review from a team as code owners February 24, 2026 17:50
@github-actions
Copy link
Contributor

👋 simsonraj, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

@github-actions
Copy link
Contributor

github-actions bot commented Feb 24, 2026

✅ No conflicts with other open PRs targeting develop

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a crash when loading MCMS contract state from the datastore on legacy networks where the Bypasser and Canceller roles resolve to the same contract address (e.g., BSC), by ensuring both role bindings are present before ABI registration.

Changes:

  • Backfill BypasserMcm from CancellerMcm (and vice versa) when only one is loaded from the datastore for a chain.
  • Prevent nil dereference during ABI population for legacy role-collapsed deployments.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 879 to 885
// When Bypasser and Canceller share the same contract address for some legacy networks, fill the gap.
if mcmsState.BypasserMcm == nil && mcmsState.CancellerMcm != nil {
mcmsState.BypasserMcm = mcmsState.CancellerMcm
}
if mcmsState.CancellerMcm == nil && mcmsState.BypasserMcm != nil {
mcmsState.CancellerMcm = mcmsState.BypasserMcm
}
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a regression test for the legacy case where only one of BypasserMcm/CancellerMcm is present (same on-chain address) to ensure this function no longer panics and that ABIByAddress is populated correctly. There are existing tests in this package, but none appear to cover this scenario.

Copilot uses AI. Check for mistakes.
tt-cll
tt-cll previously approved these changes Feb 24, 2026
athegaul
athegaul previously approved these changes Feb 24, 2026
Comment on lines 880 to 884
if mcmsState.BypasserMcm == nil && mcmsState.CancellerMcm != nil {
mcmsState.BypasserMcm = mcmsState.CancellerMcm
}
if mcmsState.CancellerMcm == nil && mcmsState.BypasserMcm != nil {
mcmsState.CancellerMcm = mcmsState.BypasserMcm
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks a bit risky. We cannot possibly deterministically know that if one of these is nil and the other is not nil the values should be assignable to another

@simsonraj simsonraj dismissed stale reviews from athegaul and tt-cll via bc384e6 February 24, 2026 20:07
cancellerMCMS = cldf.NewTypeAndVersion(types.ManyChainMultisig, deployment.Version1_0_0)
)

proposerMCMS.Labels.Add(types.ProposerRole.String())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you see these labels in Datastore as well? we decided to let go of types.ManyChainMultisig and only use specific contract type like ProposerManyChainMultisig, .CancellerManyChainMultisig in datastore to keep things simple

@trunk-io
Copy link

trunk-io bot commented Feb 24, 2026

Static BadgeStatic BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

@cl-sonarqube-production
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants